package com.qqtech.qquan.coupon.enums;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public enum CouponBaseBizzTypeDictEnum {
	/**
	 * 优惠卷base
	 */
	COUPON_BASE(1,"优惠卷base"),
	/**
	 * 商品
	 */
	MALL_PRODUCT(2,"商品"), 
	/**
	 * 服务类型
	 */
	HOME_MAKING_TYPE(3,"服务类型"),
	/**
	 * 商城类型
	 */
	MALL_CATEGORY(4,"商城类型"), 
	/**
	 * 商家
	 */
	SHOP(5,"商家"),
	/**
	 * 圈币
	 */
	MONEY(6,"圈币"), 
	/**
	 * 周边商家
	 */
	NEARBY_MALL(8,"周边商家"),
	/**
	 * 圈商
	 */
	Q_MALL(9,"邻里店"),
	/**
	 * 便利店
	 */
	CONVENIENT_MALL(10,"便利店");
	int code;
	String desc;

	private CouponBaseBizzTypeDictEnum(int code, String desc) {
		this.code = code;
		this.desc = desc;
	}

	public int getCode() {
		return code;
	}

	public void setCode(int code) {
		this.code = code;
	}

	public String getDesc() {
		return desc;
	}

	public void setDesc(String desc) {
		this.desc = desc;
	}

	public static String getDesc(Integer code) {
		CouponBaseBizzTypeDictEnum statusEnum = getInstance(code);
		if (statusEnum != null) {
			return statusEnum.getDesc();
		}
		return "";
	}

	public static CouponBaseBizzTypeDictEnum getInstance(Integer code) {
		if (code != null) {
			for (CouponBaseBizzTypeDictEnum statusEnum : CouponBaseBizzTypeDictEnum.values()) {
				if (code.equals(statusEnum.getCode())) {
					return statusEnum;
				}
			}
		}
		return null;
	}

	public static List<Map<String, Object>> getList() {
		CouponBaseBizzTypeDictEnum[] arrEnum = CouponBaseBizzTypeDictEnum.values();
		List<Map<String, Object>> list = new ArrayList<Map<String, Object>>(arrEnum.length);
		for (CouponBaseBizzTypeDictEnum e : arrEnum) {
			Map<String, Object> map = new HashMap<String, Object>();
			map.put("name", e.name());
			map.put("code", e.code);
			map.put("desc", e.desc);
			list.add(map);
		}
		return list;
	}
}
